﻿using Microsoft.Phone.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TheVerge.Phone.Controls;

namespace TheVerge.Phone.Pages
{
    public abstract class MainPage : BasePage
    {
        protected enum PageSection
        {
            Forums,
            ForumsEntries,
            Media,
            News,
            Sections,
        }

        protected override void ConfigureButtons()
        {
            AppBarHelper.ForumButton.IsEnabled = Section != PageSection.Forums;
            AppBarHelper.MediaButton.IsEnabled = Section != PageSection.Media;
            AppBarHelper.NewsButton.IsEnabled = Section != PageSection.News;
            AppBarHelper.SectionsButton.IsEnabled = Section != PageSection.Sections;
        }

        protected override bool IsMini { get { return false; } }

        protected override IEnumerable<IApplicationBarMenuItem> MenuItems
        {
            get
            {
                yield return AppBarHelper.PinToStartItem;
                yield return AppBarHelper.SettingsItem;
                yield return AppBarHelper.LoginItem;
            }
        }

        protected override IEnumerable<IApplicationBarIconButton> Buttons
        {
            get
            {
                yield return AppBarHelper.NewsButton;
                yield return AppBarHelper.SectionsButton;
                yield return AppBarHelper.ForumButton;
                yield return AppBarHelper.MediaButton;
            }
        }

        protected abstract PageSection Section { get; }
    }
}
